<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/6/1 0001
 * Time: 上午 11:59
 */


header("Content-type:JSON;charset=utf-8");  //统一输出编码为utf-8
header("Access-Control-Allow-Origin:*");

$connection = new mysqli("127.0.0.1","root","","mytps138");
mysqli_query($connection,"set names utf8");

if(!empty($_POST) && $_POST["uid"] != null && $_POST["uid"] != ""){

$sql = "SELECT*FROM cart WHERE gostatus = 1 AND uid = ".$_POST["uid"];

$res = $connection -> query($sql);
    $arrlist = array();
    if($res->num_rows>=1){
        while ($rows = $res->fetch_assoc()){
            array_push($arrlist,$rows);
        }
        print_r(json_encode($arrlist));
    }

}